 import {mapGetters} from 'vuex'
export default {
  computed: {
    ...mapGetters('m_cart',['total'])
  },
  onShow(){
    this.setBadge()
  },
  methods:{
    setBadge(){
      uni.setTabBarBadge({
        index: 2,
        // 这里的text只能是字符串类型
        text: this.total + ''
      })
    }
  },
  watch:{
    total(newVal){
      this.setBadge()     
    }
  },
}